package com.heima.admin.controller.v1;

import com.heima.admin.service.AdSensitiveService;
import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.admin.pojos.AdSensitive;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/sensitive")
public class AdSensitiveController {
    @Autowired
    private AdSensitiveService adSensitiveService;

    @PostMapping("/list")
    @ApiOperation(value = "敏感词汇查询")
    public ResponseResult findList(@RequestBody SensitiveDto dto) {
        return adSensitiveService.findList(dto);
    }


    @PostMapping("/save")
    @ApiOperation(value = "敏感词汇添加")
    public ResponseResult insert(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.insert(adSensitive);
    }

    @PostMapping("/update")
    @ApiOperation(value = "敏感词汇修改")
    public ResponseResult update(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.update(adSensitive);
    }


    @PostMapping("/delete")
    @ApiOperation(value = "敏感词汇删除")
    public ResponseResult delete(@PathVariable("id") Integer id) {
        return adSensitiveService.delete(id);
    }

}
